package com.dong.example.entity;



import com.dong.es.entity.EsBaseDTO;
import com.dong.es.entity.searchparam.index.EsIndexParam;
import com.dong.example.constant.EsIndexConst;

import java.io.Serializable;
import java.util.Date;

/**
 * @description: ES 对应的查询参数
 * @auth: 陈瑞东
 * @create: 2022-05-19 16:05
 */
public class DemoESDTO extends EsBaseDTO implements Serializable {

    private static final long serialVersionUID = 7581968914503724907L;

    {
        new EsIndexParam(EsIndexConst.INDEX_ES.value() + "*").addTo(this);
    }

    public static final String ID = "iD";
    public static final String NAME = "name";
    public static final String QUERY_TIME = "queryTime";

    /**
     * 字段名称
     */
    public static enum Field implements EsBaseDTO.Field {

            ID(DemoESDTO.ID, Long.class),
            NAME(DemoESDTO.NAME, String.class),
            QUERY_TIME(DemoESDTO.QUERY_TIME, Date.class),
            ;

        private String field;
        private Class type;

        @Override
        public String field() {
            return field;
        }

        @Override
        public Class type() {
            return type;
        }

        Field(String field, Class type) {
            this.field = field;
            this.type = type;
        }
    }

}
